package com.ruoyi.project.system.service.impl;

import com.ruoyi.project.system.domain.PatientList;
import com.ruoyi.project.system.mapper.PatientListMapper;
import com.ruoyi.project.system.service.IPatientListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

@Service
public class PatientListServiceImpl implements IPatientListService {

    @Autowired
    private PatientListMapper patientListMapper;

    @Override
    public List<PatientList> getCurrentDayPatients(Long doctorId) {
        LocalDate today = LocalDate.now();
        LocalDateTime startTime = today.atStartOfDay();         // 今天 00:00:00
        LocalDateTime endTime = today.atTime(LocalTime.MAX);    // 今天 23:59:59

        // 调用 Mapper 查询
        return patientListMapper.selectByDoctorIdAndDateTimeRange(
                doctorId,
                startTime,
                endTime,
                0 // resolve = 0 (未处理)
        );
    }
}